{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "de515fbe-d363-4529-b97a-ce5c301eca97",
   "metadata": {},
   "source": [
    "# 下载Labelme样例数据集\n",
    "\n",
    "同济子豪兄 2023-4-16\n",
    "\n",
    "SJB_25_Dataset数据集，包含25张30度直角三角板的图像，标注了以下信息：\n",
    "\n",
    "- 目标检测框（rectangle）：30度直角三角板（sjb_rect）\n",
    "\n",
    "- 关键点（point）：30度角点、60角点、90度角点（Angle_30、Angle_60、Angle_90）\n",
    "\n",
    "- 多段线分割（polygon）：30度直角三角板区域（sjb_poly）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cca781c3-fd42-4483-8092-cbf5e35ff70a",
   "metadata": {},
   "source": [
    "## 下载数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b4209274-5901-4b07-97b7-0fe006144500",
   "metadata": {},
   "outputs": [],
   "source": [
    "!rm -rf SJB_25_Dataset.zip SJB_25_Dataset\n",
    "!wget https://zihao-download.obs.cn-east-3.myhuaweicloud.com/yolov8/datasets/SJB_25_Dataset.zip"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0ba7cd7-a187-49b6-b122-02b3afefeb9a",
   "metadata": {},
   "source": [
    "## 解压数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2d3c481a-abd8-4474-8645-959a0c8c1759",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 解压\n",
    "!unzip SJB_25_Dataset.zip >> /dev/null\n",
    "\n",
    "# 删除压缩包\n",
    "!rm -rf SJB_25_Dataset.zip"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "287f814d-7002-4d6d-a685-f2b2bfffc5fc",
   "metadata": {},
   "source": [
    "## 删除系统自动生成的多余文件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4619bf05-497e-4add-bafb-ce831c08a704",
   "metadata": {},
   "source": [
    "### 查看待删除的多余文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5153d861-3d5d-420f-a4b0-16c3ecfb2789",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '__MACOSX'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6b423982-28ab-489b-9098-bd320efce691",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.DS_Store'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f0a0b32b-6a1c-414b-a73b-d1fa0a6b2dd7",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.ipynb_checkpoints'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e8e0af02-2899-4760-b8f5-68702569997b",
   "metadata": {},
   "source": [
    "### 删除多余文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "35779340-12c3-4321-9f38-a5edc9f5a276",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '__MACOSX'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "ff791934-57ff-4f5a-a7c8-a4d02ff51387",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '.DS_Store'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "12825d8a-aa3f-4a54-8d40-ea71ee9e259a",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '.ipynb_checkpoints'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a043d6e5-105c-4afe-9c8c-bcf65681b997",
   "metadata": {},
   "source": [
    "### 验证多余文件已删除"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "2baf7b19-f67b-43bf-a4dd-2fad000c09b4",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '__MACOSX'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "73aaaa40-ecd4-457d-9bc8-7f264e55e567",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.DS_Store'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "0fd367c6-61d0-4d0b-8d84-0eea5cd17660",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.ipynb_checkpoints'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "90b542da-9ec3-40b9-bfe9-4838376a46ec",
   "metadata": {},
   "source": [
    "## 查看数据集目录结构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "201fe4dd-923f-450e-9fb8-4076e87edc01",
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install seedir emoji"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a27da81c-92f2-4b29-9111-5f7e8819c5a0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "📁 SJB_25_Dataset/\n",
      "├─📁 images/\n",
      "│ ├─📄 DSC_0219.jpg\n",
      "│ ├─📄 DSC_0209.jpg\n",
      "│ ├─📄 DSC_0236.jpg\n",
      "│ ├─📄 DSC_0293.jpg\n",
      "│ ├─📄 DSC_0245.jpg\n",
      "│ ├─📄 DSC_0278.jpg\n",
      "│ ├─📄 MVIMG_20230331_080908.jpg\n",
      "│ ├─📄 MVIMG_20230331_080920.jpg\n",
      "│ ├─📄 DSC_0285.jpg\n",
      "│ ├─📄 DSC_0284.jpg\n",
      "│ ├─📄 DSC_0280.jpg\n",
      "│ ├─📄 DSC_0281.jpg\n",
      "│ ├─📄 DSC_0240.jpg\n",
      "│ ├─📄 DSC_0283.jpg\n",
      "│ ├─📄 DSC_0269.jpg\n",
      "│ ├─📄 DSC_0282.jpg\n",
      "│ ├─📄 DSC_0259.jpg\n",
      "│ ├─📄 MVIMG_20230331_080914.jpg\n",
      "│ ├─📄 MVIMG_20230331_080915.jpg\n",
      "│ ├─📄 DSC_0289.jpg\n",
      "│ ├─📄 DSC_0260.jpg\n",
      "│ ├─📄 DSC_0274.jpg\n",
      "│ ├─📄 DSC_0301.jpg\n",
      "│ ├─📄 DSC_0265.jpg\n",
      "│ └─📄 MVIMG_20230331_080912.jpg\n",
      "└─📁 labelme_jsons/\n",
      "  ├─📄 DSC_0209.json\n",
      "  ├─📄 DSC_0219.json\n",
      "  ├─📄 DSC_0236.json\n",
      "  ├─📄 DSC_0240.json\n",
      "  ├─📄 DSC_0245.json\n",
      "  ├─📄 DSC_0259.json\n",
      "  ├─📄 DSC_0260.json\n",
      "  ├─📄 DSC_0265.json\n",
      "  ├─📄 DSC_0269.json\n",
      "  ├─📄 DSC_0274.json\n",
      "  ├─📄 DSC_0278.json\n",
      "  ├─📄 DSC_0280.json\n",
      "  ├─📄 DSC_0281.json\n",
      "  ├─📄 DSC_0282.json\n",
      "  ├─📄 DSC_0283.json\n",
      "  ├─📄 DSC_0284.json\n",
      "  ├─📄 DSC_0285.json\n",
      "  ├─📄 DSC_0289.json\n",
      "  ├─📄 DSC_0293.json\n",
      "  ├─📄 DSC_0301.json\n",
      "  ├─📄 MVIMG_20230331_080908.json\n",
      "  ├─📄 MVIMG_20230331_080912.json\n",
      "  ├─📄 MVIMG_20230331_080914.json\n",
      "  ├─📄 MVIMG_20230331_080920.json\n",
      "  └─📄 MVIMG_20230331_080915.json\n"
     ]
    }
   ],
   "source": [
    "import seedir as sd\n",
    "sd.seedir('SJB_25_Dataset', style='emoji', depthlimit=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4a6ef95a-43e5-40cb-84b3-4e2fce6c4ad5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
